﻿/*
------------------------------------
    Rodeo Game Engine

    Rodeo Math Module
    MathSystem.h - header file

    Copyright(c) Marcin Goryca
------------------------------------
*/
#ifndef RODEO_MATH_MATHSYSTEM_H_
#define RODEO_MATH_MATHSYSTEM_H_

#ifndef RODEO_CORE_SINGLETON_H_
#include "core\singleton.h"
#endif    //RODEO_CORE_SINGLETON_H_

#ifndef RODEO_MATH_MATHTOOLS_H_
#include "math\mathtools.h"
#endif    //RODEO_MATH_MATHTOOLS_H_

#ifndef RODEO_TOOLS_RANDOMNUMBERGENERATOR_H_
#include "tools\randomnumbergenerator.h"
#endif    //RODEO_TOOLS_RANDOMNUMBERGENERATOR_H_

namespace rodeomath
{
class MathSystem : public rodeocore::Singleton<MathSystem>
{
public:
    MathSystem()
    {
        init();
    }

    ~MathSystem(){}

    // Gets the random number
    CRandom getRandomNumber() const { return random_number_; }

    // Gets specified member of sinus table
    // Returns float value of specified index from sinus table
    float getSinusTable(int index) const { return sinus_table_[index]; }

    // Gets specified member of cosinus table
    // Returns float value of specified index from cosinus table
    float getCosinusTable(int index) const { return cosinus_table_[index]; }

private:
    // Runs Random Number Generator (Mersenne Twister)
    void runGenerator();

    void init();

//==== MEMBERS ====//
 
    // Random Number
    CRandom random_number_;

    // Full Sinus Table
    float sinus_table_[rodeocore::RODEO_FULL_CIRCLE];

    // Full Sosinus Table
    float cosinus_table_[rodeocore::RODEO_FULL_CIRCLE];
};
}    // end of rodeomath namespace
#endif    //RODEO_MATH_MATHSYSTEM_H_